//
//  UIImageViewExt.swift
//  test-ios
//
//  Created by wyz5204 on 2023/6/6.
//

import Foundation
import UIKit
import Kingfisher

//MARK: UIImageView
extension UIImageView {
    func glImage(_ imageUrl: String?, placeHolder: String? = nil) {
        guard let urlStr = imageUrl else {
            return
        }
        let url = URL.init(string: urlStr)
        guard let urlS = url else {
            return
        }
        /// 占位图
        let holder = KFCrossPlatformImage.init(named: placeHolder ?? "placeholder")
        holder?.add(to: self)
        let resource = ImageResource.init(downloadURL: urlS)
        self.kf.setImage(with: resource, placeholder: holder)
    }
}
